package com.yunchao.test.data.datasource.model

import androidx.room.Entity
import androidx.room.PrimaryKey
import com.yunchao.test.domain.model.MaintenanceInfoModel
import java.util.Date


@Entity(tableName = "maintenance_info")
internal data class MaintenanceInfoEntityModel(
    @PrimaryKey(autoGenerate = true) val id: Int = 0,
    val lockNo: String,  //锁号
    val manufactureDate: String, //生产日期
    val warrantyPeriod: String, //保修期
    val salesLocation: String, //销售地点
    val lockTid: String, //锁tid
    val createTime: Date = Date(),//创建时间
    val updateTime: Date? = null, //更新时间
    val deleteTime: Date? = null //删除时间
)





internal fun MaintenanceInfoEntityModel.toDomainModel() = MaintenanceInfoModel(
    lockNo = lockNo,
    manufactureDate = manufactureDate,
    warrantyPeriod = warrantyPeriod,
    salesLocation = salesLocation,
    lockTid = lockTid,
)